package com.sj.thread.c_026;

import java.util.concurrent.Executor;

/**
 * 作用, Executor 可以传入一个Runnable接口, runnable接口用于定义一项任务, 将任务传递给Executor后, 由 Executor.execute() 方法定义如何执行任务
 */
public class T01_MyExecutor implements Executor {
    static int count = 1;

    public static void main(String[] args) {
        byte a = 1;

        a = (byte) (a + 4);
        a += 4;

        System.out.println(a);
    }

    @Override
    public void execute(Runnable command) {
        command.run();
        // new Thread(command).star();
    }

  /*  private static class SinHolder { //初始化一个类
        public static final T01_MyExecutor SIN = new T01_MyExecutor();
    }

    private T01_MyExecutor() {
    }

    // JVM帮助我们保证了线程的安全性，在类进行初始化时，别的线程是无法进入的。
    public static T01_MyExecutor getSin() {
        return SinHolder.SIN;
    }*/

}
